
import Mock from 'mockjs'
import apiData from './mockdata.json'
Mock.mock('/mock', { code: 0, data: apiData.data })// data：要返回的数据
// 是拦截请求地址为/mock的请求，并返回一个data,data内容为2 - 4条属性，在里面随机选2 - 4条。
var Random = Mock.Random
Random.extend({
  constellation: function(date) {
    var constellations = ['白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座', '水瓶座', '双鱼座']
    return this.pick(constellations)
  }
})
Mock.mock('/ac', {
  code: 0,
  data: [Mock.mock('@CONSTELLATION'), '@CONSTELLATION', Random.constellation()]
})

Mock.mock('/mocks', {
  code: 0,
  data: [Mock.mock({
    'obj|2': {
      id: 1,
      name: 'jx',
      age: 18,
      address: 'JiNan',
      love: 'you'
    }
  })]
})